// 资源管理模块接口
import { requestErrHandle } from "../base/index.mjs";
/**
 * 请求回调
 * @callback requestCallback
 * @param {object} data 请求回调的数据
 */
export default {
	/**
	 * 获取试题启用状态列表
	 * @param {object} opt
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionEnableStatus(opt = {}) {
		Http.callService({
			url: "rc/admin/common/question/enablestatus",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取试题审核状态列表
	 * @param {object} opt
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionAuditStatus(opt = {}) {
		Http.callService({
			url: "rc/admin/common/question/auditstatus",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取用户的试题展示列表
	 * @param {object} opt
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionUserCustomList(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/user/customshow/list",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 修改用户的试题展示列表
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.customIds 显示的字段数组
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateCustomShow(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/user/customshow/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},

	/**
	 * 获取全部试题分页列表
	 * @param {object} opt
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionAllList(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/all/list",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 批量修改试题信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.resourceIds 试题标识数组
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateBatchQuestion(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/batch/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 批量启用禁用试题
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.resourceIds 试题标识数组
	 * @param {string} opt.data.isAvailable 启用禁用状态 {"Y","N"}
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateBatchQuestionAvailable(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/available/batch/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 修改一个试题启用禁用状态
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.resourceId 试题标识数组
	 * @param {string} opt.data.isAvailable 启用禁用状态 {"Y","N"}
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateQuestionAvailable(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/available/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 批量审核试题
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.resourceIds 试题标识数组
	 * @param {string} opt.data.checkStatus 审核 {"Y","N"}
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateBatchQuestionAuditStatus(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/auditstatus/batch/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取试题识别结果
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {Array} opt.data.resourceIds 试题标识数组
	 * @param {string} opt.data.checkStatus 审核 {"Y","N"}
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	recognizeQuestion(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/recognize/get",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源-获取试题识别Word模板
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	getQuestionTemplateUrl(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/word/model/url/get",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源-获取试题详情信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionDetailInfo(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/detail/info",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源-新增试题信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	addQuestion(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/add",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源-删除试题信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	deleteBatchQuestion(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/batch/delete",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 *试题资源-试题详情-编辑回显使用(仅适用于组合题或独立题型)
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryResourceInfo(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/info",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
     /**
     * 获取一个小题试题信息(编辑组合题下小题时回显使用)
     * @param {object} opt
     * @param {object} opt.data
     * @param {requestCallback} [opt.success] 请求成功回调
     * @param {requestCallback} [opt.complete] 请求完成回调
     */
      querySmallResourceInfo(opt = {}){
        Http.callService({
            url: "rc/admin/resourcequestion/small/info",
            data: opt.data || {}
        })
            .success((data) => {
                opt.success && opt.success(data);
            })
            .complete((data) => {
                opt.complete && opt.complete(data);
            });
    },
	/**
	 * 试题资源-编辑试题
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateResource(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源-编辑大题种的小题
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateSmallResource(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/small/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},

	/**
	 * 试题资源- 获取试题的知识点列表
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionKnowledgeList(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/knowledge/relation/list",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 试题资源- 批量新增
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	batchAddQuestion(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/batch/add",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			}).error((...err) => {
				opt.error && opt.error.apply(this, err);
			}).fail((...fr) => {
				opt.fail && opt.fail.apply(this, fr);
			});
	},
	/**
	 * 根据多个id批量获取试题详情
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {String} opt.data.resourceIds 资源标识集合
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionInfoBatch(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/supplementary/info/list",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 编辑试题的标签和其他信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {String} opt.data.resourceId 资源标识
	 * @param {String} [opt.data.applicableYear] 适用年份
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	updateQuestionSupplementary(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/label/info/update",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	/**
	 * 获取试题资源的基本信息
	 * @param {object} opt
	 * @param {object} opt.data
	 * @param {String} opt.data.resourceIds 资源标识集合
	 * @param {requestCallback} [opt.success] 请求成功回调
	 * @param {requestCallback} [opt.complete] 请求完成回调
	 */
	queryQuestionBaseMessage(opt = {}) {
		Http.callService({
			url: "rc/admin/resourcequestion/basemessage",
			data: opt.data || {}
		})
			.success((data) => {
				opt.success && opt.success(data);
			})
			.complete((data) => {
				opt.complete && opt.complete(data);
			});
	},
	batchRepeatRewrite(params = {}) {
		return requestErrHandle("rc/admin/resourcequestion/batch/repeat/rewrite", params);
	},
	queryQuestionInfoV(params = {}) {
		return requestErrHandle("rc/admin/resourcequestion/repeat/question/info", params);
	},
};
